package main

import "fmt"

func main() {
	str := "hello,golang"
	s1, s2 := Cut(str, 5)
	fmt.Println("s1 : ", s1)
	fmt.Println("s2 : ", s2)

	s3 := str[len(str)/2:] + str[:len(str)/2]
	fmt.Println("s3 : ", s3)

	s4 := Reverse("google")
	fmt.Println("s4 : ", s4)
}

func Cut(str string, ix int) (string, string) {
	return str[:ix], str[ix:]
}

func Reverse(str string) string {
	r := []rune(str)
	for i, j := 0, len(r)-1; i < j; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}
